#lang racket

(define (substitute new old lst)
  (cond 
    [(empty? lst) empty]
    [else (cond
            [(equ? old (first lst)) 
              (cons new (substitute new old (rest lst)))]
            [else (cons (first lst) (substitute new old (rest lst)))]
            )])
  )

(define (equ? a-symbol a)
  (cond
    [(symbol=? a-symbol a) true]
    [else false])
  )

; Test
(define ttbl
  (cons 'Moscom
     (cons 'doll
       (cons 'box
         (cons 'doll empty))))
  )

(substitute 'dollar 'doll ttbl)
